//
//  MenuViewController.m
//  SPDBank
//
//  Created by hanxifeng on 14-12-25.
//  Copyright (c) 2014年 王 焕. All rights reserved.
//

#import "MenuViewController.h"
#import "OBShapedButton.h"
@interface MenuViewController ()

@end

@implementation MenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"浦发银行"];
    //背景图
    self.view.backgroundColor = [UIColor colorWithPatternImage:IMG(@"MenuBack")];
    //搭建界面
    [self buildUI];
}

#pragma mark 搭建界面
-(void)buildUI{
    
//    for (int i = 1; i < 9; i++) {
//        NSString *imageName = [NSString stringWithFormat:@"a%d",i];
//        UIImageView *image = [[UIImageView alloc]initWithImage:IMG(imageName)];
//        OBShapedButton *btn = [[OBShapedButton alloc]initWithFrame:CGRectMake(0, 0, image.frame.size.width, image.frame.size.height)];
//        btn.center = CGPointMake(1024/2, 768/2);
//        [btn setImage:IMG(imageName) forState:UIControlStateNormal];
//        
//        [btn addTarget:self action:@selector(btnAct) forControlEvents:UIControlEventTouchUpInside];
//        
//        [self.view addSubview:btn];
//    }
    
   
    
    UIImageView *image = [[UIImageView alloc]initWithImage:IMG(@"a1")];
    CGFloat width = image.frame.size.width;
    CGFloat height = image.frame.size.height;
    
    OBShapedButton *btn1 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2-3, (768 - height)/2, width, height)];
//    btn1.center = CGPointMake(1024/2, 768/2);
    [btn1 setImage:IMG(@"a1") forState:UIControlStateNormal];
    [self.view addSubview:btn1];
    
    OBShapedButton *btn2 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2+3, (768 - height)/2+3, width, height)];
//    btn2.center = CGPointMake(1024/2, 768/2);
    [btn2 setImage:IMG(@"a2") forState:UIControlStateNormal];
    [self.view addSubview:btn2];
    
    OBShapedButton *btn3 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2+2, (768 - height)/2+3, width, height)];
//    btn3.center = CGPointMake(1024/2, 768/2);
    [btn3 setImage:IMG(@"a3") forState:UIControlStateNormal];
    [self.view addSubview:btn3];
    
    OBShapedButton *btn4 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2+2, (768 - height)/2+2, width, height)];
//    btn4.center = CGPointMake(1024/2, 768/2);
    [btn4 setImage:IMG(@"a4") forState:UIControlStateNormal];
    [self.view addSubview:btn4];
    
    OBShapedButton *btn5 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2+4, (768 - height)/2+3, width, height)];
//    btn5.center = CGPointMake(1024/2, 768/2);
    [btn5 setImage:IMG(@"a5") forState:UIControlStateNormal];
    [self.view addSubview:btn5];
    
    OBShapedButton *btn6 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2, (768 - height)/2, width, height)];
//    btn6.center = CGPointMake(1024/2, 768/2);
    [btn6 setImage:IMG(@"a6") forState:UIControlStateNormal];
    [self.view addSubview:btn6];
    
    OBShapedButton *btn7 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2, (768 - height)/2-2, width, height)];
//    btn7.center = CGPointMake(1024/2, 768/2);
    [btn7 setImage:IMG(@"a7") forState:UIControlStateNormal];
    [self.view addSubview:btn7];
    
    OBShapedButton *btn8 = [[OBShapedButton alloc]initWithFrame:CGRectMake((1024-width)/2, (768 - height)/2, width, height)];
//    btn8.center = CGPointMake(1024/2, 768/2);
    [btn8 setImage:IMG(@"a8") forState:UIControlStateNormal];
    [self.view addSubview:btn8];
    
    UIImageView *logoImage = [[UIImageView alloc]initWithImage:IMG(@"c1")];
    logoImage.center = CGPointMake(1024/2, 768/2);
    [self.view addSubview:logoImage];

}

-(void)btnAct{

    NSLog(@"ddddddddd");
}

@end
